//
//  UIImageView+AWTheme.m
//  changeShin
//
//  Created by Alan Wang on 2019/3/25.
//  Copyright © 2019 Alan Wang. All rights reserved.
//

#import "UIImageView+AWTheme.h"
#import "NSObject+AWTheme.h"


@implementation UIImageView (AWTheme)
-(void)AWTheme_ImageForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.image = [[AWThemeManager shareInstance] imageForKey:key];
    } forKey:@"image"];
}

//初始化的时候是不是高亮状态
-(void)AWTheme_HighlightedForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.highlighted = [[AWThemeManager shareInstance] boolForKey:key];
    } forKey:@"highlighted"];
}
//高亮状态下的图片
-(void)AWTheme_HighlightedImageForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.highlightedImage = [[AWThemeManager shareInstance] imageForKey:key];
    } forKey:@"highlightedImage"];
}


//居于buddle的API
-(void)AWTheme_ImageForName:(NSString*)key buddleName:(NSString*)buddleName{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.image = [[AWThemeManager shareInstance] imageForName:key fromBudddle:buddleName];
    } forKey:@"image"];
}
//高亮状态下的图片
-(void)AWTheme_HighlightedImageForName:(NSString*)key buddleName:(NSString*)buddleName{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.highlightedImage = [[AWThemeManager shareInstance] imageForName:key fromBudddle:buddleName];
    } forKey:@"highlightedImage"];
}
@end
